Attempts to make camera handling more robust; needs testing.