events: use functions module