Merge with other navigation related branches

A few refactorings too.