Refactored a lot of the existing code in preparation for more progress.