refactoring task service spec and implementation