Implementation for switches

- Completely refactored the code for how switches work
- added an interface which needs to be implemented by all objects that
are supposed to interact with switches