Improved navigation code.