Improved scripting a bit.
Added an example script