Rebase of #10

Closes #10