refactor controller to use as syntax