add h_search method, and reorganize mixed up methods and subroutines