Implemented controllers with classes instead of functions.