update code with dp