main & measure activity refactored