Refactor Codebase - Type hints / Black formatter / Docstrings

For all functions we should:

  • Run black
  • Add docstrings to explain what's going on
  • Add type hints to make it easier to understand what's passed in and returned out

Additionally, refactoring logic throughout the codebase to simplify / reduce lines.