Add events and make it actually work