Creating the controller for the SMChat application