cleaned up iterator functions