Render nav from sql
Restyled and refactored some code generation