Big refactoring of tests