Convert functions.php to controller.php