Basic implementation done

I probably need more tests, but this is a working version with a simple
API.