Improve Ruff Formatting and TypeChecking