Resolved some (not yet all) broken references, removed unused imports, and separated multiple statements in single lines to multiple lines.