Relocate a variable declaration to the function where it is used