Fixed motion and added timer for detection of rest