Get the controllers to not be global functions, breaks the tests currently
And fix the tests. YAY, all horrible globals dead.