Adding clone function and tests