Add more integration testing and more handling of exceptions