modifyt by william
modify the willaim code by jingjing