removed unnecessary code and variables
removed some more wrong copied code