Refactor activity tracker