Enclose controller in anonymous function.