Added events and fixed arrays

Fixes #5