Changed order of subroutines