refactored the task stuff into a service