Add service layer.

- Fix tests
- Clean up