Move variables closer to where they are going to be used