add some comments to clarify
remove extra logging statements