added comments to print function