HFMethod bug fixes, refactoring