Better calculation of fees. (probably? Let me know if you see something better.)