adapted click to search function