Add more complete exception handling