did a little refactoring