calc subroutine added