clean up server app by moving stuff to controllers