Changed to vanilla object iterator for older browsers