upgrade to fix bugs and add some powerful functions.