updated main code for camera etc.