a little refactoring to simplify future development