code commited from Rep2