few tests, little refactoring