initial working codes for PH Prefix Search