Adding signal handling
Improving signal handling