webcam logic