Move more declaration to top of function for ANSI