Removed code duplication for setting up window and rootviewcontroller

I've made a small method to setup the window and rootviewcontroller, so it doesn't have code duplication there :)