moving functionality into service