added calc regression tests and bug fixes.