Motion detector code added