added subroutine definitions from spec