Added cleanup() which will be invoked when user sends INT or TERM
signals