moving some logic into services