Commented the code and added a few progress prints