script rewrite, bugfix and optimize
readme update