Fixed things and removed unnecessary code