reformatting.
inject exec function to decouple some with testing cases.
test cases for `calculateAmountToTrim()`