Moved controller functionality into separate file out of server