Refactor of MainActiviy