doing the same as in last commit but in a more elegant way
using process.on() instead of process.addListener() in program module