Add more exception handling