Rewrite Continued

Restored more functionality and made minor changes here and there. See commits for details.