code_TP4 almost done