Small refactor of legal_to_castle method