fixed script, removed unnecessary code