Move variable closer to where it's required