main activity refactoring Refs #221