bugfix
js nonsense
start taking a hack at turning this into OO-design
tidy up scripting events a bit