rework code for camera