contact sensor code updated