move clone function above class