Refactored custom Hash trees processing