refactor rate.py to make experimenting easier