Removing warnings and unnecessary code