initial work on Dynamic programming