simplified the observer pattern using a switch