Refactor viewnavigator