Adding more exception handling