Hmmm - except shouldn't be both subtracting from max and adding to ret