Full tests rewrite. Closes #1940