working on the motion detector