Fixed the most warnings for unused vars/includes and unchecked vars.