Adding DP implementation