refactored object detection and wall alightment