Moved the stuff outside the for loopo