modify Lock test, add Search algorithm