Added back navigation buttons and refactored init function