fixes index error in pathfinding, removed unused stuff