update tests + refactoring