Fix order of functions