added the code for deterministic search but still not working