rewrite the code, now it looks more clear to read.

and easier to understand.

Signed-off-by: sunus <sunuslee@gmail.com>
Merge branch 'master' of https://github.com/sunuslee/bub