PATHFINDING FUCKING SOLVED!

must optimize!