moving logic to services