refactored by removing rendering responsibilities from controller and giving it to the view by writing a new method