Rearrange some camera code