Refactoring of hmd class