Started to add exceptions handling when the program is interrupted.