laying out the foundation and classes for rewrite