Refactor tests. Fixes issue #31.