Refactor of activity module to make it unit testable
Added unit tests for activity module