Did some code refactoring in Activities