Improved memory usage in route finding