new function clonerepository() and some other changes