Use forIn to ensure Object iteration is performed
Correct iteration key issue
Fix API errors, add slight simplifications