re-writing as a service instead of a directive