Main: Further refactoring of page handling
This removes the need to set the currentIndex at the end by instead inserting pages after pushing the initial page. It also ensures that we never try to push null as a page which seems to cause subsequent pages to not get pushed.
Requires !113 (merged) first.