remove unnecessary function nesting in Object.clone method