Fixed the rounding in nav.cpp and moved some variables