This would be a good occasion to stop naming variables `f` and `d` :p