Cleaning up navigation and adding some logic.