Added event system, credits to Marcusant for the event system.
Added event system, credits to Marcusant