a little refractoring