refactored on/off methods to use state objects