Use interfaces

Fixes #3.