refactored to use htk