Rewrite tests. Closes #23