foreach exercise cleaned up