refactor to extract get key pointer method