compute.py refactor