Add RESOURCE for event and generic handling.

Now events are handled in the same way. Code ready to be tested.
Start addind documentation on headers.