Fixing event handler interface, and making some minor improvements.

Improvements include:
 * making style definition more generic for types
 * allowing event handlers to be specified as options
 * generating node elements already expanded if tree starts expanded