Initial commit of rewrite (version 2.0)