change var names, and remove old code