Improvements to signal handling