Re-coded search slightly