refactored service to use factory, updated tests