Simplify code in settlement end