Added events other scripts to hook onto, also refractored a bit and added some xml comments