error handling added
better sigint handling