Added looptime subroutine