Added support for transactions

This fixes #6.

@fceller ping