reduing picamera code