Code cleanup to be more conforming to style guide.

- Return `Unit` instad of using procedure syntax.
- Explicitly listed return type for `def`s.
- Added/removed `()` for arity-0 methods depending on whether they have side-effects.
- Removed unused imports.
- Fixed missing "`" in doc strings.
- Removed redundant `final` qualifier.