a little refactoring of models controller