refactored the counter and the rest client to fit the fragments