Implemented A* pathfinding