Minor clean-ups; added internal mode change API