added PIR motion detector code