Pass variables instead of assuming they exist.
Remove unused imports.