refactoring code Controllers, Model, Extension