minor change to use temp variable