adds events
fixes script nightmare. Removes a lot of old code from editor