Imported from https://github.com/haamoon/finding_common_object