Import cleanup.
Make debug code be run if in debug mode.
Use generics to fix a warning.