[WIP]some rewriting