Improve documentation and add several tests

Closes #1