First crack at implementing the API
Adds test coverage