implemented clone function