further changes to switch implementation