Fix order of function declaration