Use dict.get() consistently and clean up minor spacing issues.