Refactoring get_key to get_bucket_key