Refactorings to reduce code and increase clarity. Templatize nav.