renamed variables, remove useless code