slight modifications to calc