Explain recalc and upd function used in the code

Please explain the functions used in the solution