add service tests and refactor into subpackage