Move some code from analysis.cpp into HMM class
Change public/protected accessibility