initialize `quality` to 0.8 right here (or 0.75 if you follow my other advice :) ), this will eliminate the need for the if-block inside the function