cleaned up iterator problem; added map code