added more error catches for use cases.