refactor return space conditions