Merge pull request #58 from pkaifosh/motion-refactoring

Motion refactoring
HMM refactoring to combine 2D and 3D. 2D might be slower.