Modified camera code to handle activity restart