little refactoring for fun