Reorganized code, groundwork for features

Reorganized namespaces, adding foundations for what will allow WYSIWYG &
advanced formatting features.