huge controller refactor