new structure, smaller fixes

added testing, fixed regex, added unbind, fixed triggerStateChange()