Exception Handling

Added more exception handling