fixed navigation and cleaned up code