Ported calc5 to X3 (Same as Calc4, this time, we'll incorporate debugging support, plus error handling and reporting).