Changed order of code