Total rewrite of clone procedure