rewrite, reorganized