playing around with dynamic programming