refactored to separate services