Moved some variable declarations that were defined in an outer scope