Converted cal.php to a class.