make some rewrite and tidy up, but this is still worse