refactoring done
merged with both services