Add functional test

Closes #16