error handling and working on large dataset