Create working search function