Add functional tests

Closes #17