Misc optimizations

Re-written navigation, various other JS optimizations