Bring variables declaration to where they are really needed.