refactor for search
demo version ok