refactored to reduce dependency on specific data and allow subclassing of the markov model