cleaning up maze code