adding book-keeper class & bayes dp