aStar logic