Moved the controller into local code / closure.