Create test

Resolves #369 and fixes a few bugs.