Changed the order of functions just to fit with their prototypes. Nothing major.