some errors,generally works
works, subtle bug in path finding