refactor compute.py

@ibuildthecloud @cjellick