moved variable closer to where it is used