little refactoring code