changed initialization of the IntPtr for return
improved Pathfinding