Changed the order of functions.