refact controller and model