added print statements for progress monitoring