Reduce repeated code to set up tabs

Refactored repeated code in MainActivity to aid readability and make it easier to add a new tab.