updates after deshipu's review on PR #521