finished controller refactor