Refactoring

This is the pull request that will be used for code review, tracking progress, and eventually generating the patch set for this project.