Refactor into services