Switched example to use RequireJS; minor library API tweak