takePhoto Function upgraded