a little refactoring