what are the functions of the controller?