A little refactor of code