added events reworking it to be more like javascript