Fix function declaration orders