HW4: Search function almost completed.