Adding tests and docs

Closes #199