Refactored to make room for wall-finding code