bySum and byAmount working nicely, finally