using dp, still has something wrong.