Revert "rewrite"

This reverts commit cf044df5433f360b61796e2d51875de0590e7fda.