Complete refactoring of tests