Added functions to the eventhandlers