Added Events and variable replacement class