added new iteration over myList and corrected algorithm