more comments and minor fix in randNum