cleaned up code, FIXED PERSPECTIVE BUG in heuristic