Refactored events system. Added tests for "selectionchange"