more refactoring. moved navigation related functions to nav.js. removed old constraints