a little refactoring...