cal: code cleanup