Merge pull request #456 from jonohart/master

Performance fix for adding switches