Made events table local
Wrapped API functions to a local table
Camel-case style for functions names
Updated code example