refactoring duplication out from nav bar

This replaces PR #32.