Now I'm using dynamic programming