Declare variables closer to where they're used