Corrected line 63 (removed sorting, added iterkeys instead of keys)