Tests: rewrite tests. Closes #1 abd #2.