modifications to error handling and file watching