Added PIR code