changed cal functions