adds nav and layout, refactors javascript