removed unnecessary code, bug fixes