Some code cleanup and optimize imports.