We implemented it ourselves, but in retrospect we should've used a* for it cuz that would be easier to debug