Refactor Controller key lookup

Also add helper method _get_key.