Clean up Python code and backend.js