Breaking big function in two smaller functions and aplying corrections