little refactory code