Deduplicate code and whitelist #singleton_method?.