correcting order of subroutine initialization