Edited camera capture code