Fix typing
Fix formatting and comments