tests, a little refactoring