Updated code, removed unnecessary code