FlattenByAmount works, is probably inefficient