added exception handling and progress printing