commented and refactored mazesolver code