updated controller with changes so they would function properly