Fixed crash when controller was not initialized in MainFragment
and cleaned up MainFragment a bit