modify code clearly && add unittest