New tests + refactoring