Added cloneInstance procedure. Work in progress.