fixed errors,renamed var names