added minimumBy helper function