Improve iterator by making the object templates just once

- also remove the use of 'auto'