Fixing the order of functions