testing and cleanup. implementing the clone function