added "if (!obj.hasOwnProperty(key)) return;" to object for loops