subroutine entry and exit