origin code but only changed name of some variables and function