Refactor the time-polling service