Changed the placement of code