Cleaned some code.

  * Removed unused imports.
  * Added type hints to several methods and functions (for IDEs).