fix typo, code style, change pseudo-random to random
change file structure, add tests