fixed warnings and removed unnecessary code