(1) More cleanup. (2) Adding support for different number of rounds. (3) Adding function to init the context.