Optimize the code and modify the view.