improved the error handling + support for reading the history