Add process events subroutine