Best control structure for task of aligning motor with sensor

Geez, please disregard my last two posts. I think I figured it out: You have to actually TELL the thing when to shut off the relay. Duh! There is no need for a redundant detection line in the move call. Thanks Allan. Now I have to figure out how to throw a time-out feature for when the motor doesn't actually move. But before that, I need to do some more reading on the millis() command.