main activity refactor