put comments and improve testing on index variable
comment and test index and stamp variables