Basic functionality.

Not fully tested.