slight code tweak and comments