optimized api search method, but form still doesnt work