(Needs testing)Adding signal fucntion, to terminate using kill command