Implemented back button navigation

Also refactored MainActivity a bit - methods are now grouped by
categories (mainly by their superclass) and easier to find.
Fixed a bug with up button navigation