Split up logic into services and factories