implemented A*