more comments and some optimization for searchm