Calculate rate*fee first before dividing by 1000. Add more unit tests around the fee calculations.
No functional change. Add tests.