Clean up logic.py