Service class

Adds tests and closes #310