Final touches

Still have some modularizations that can be completed, but close to
fully cleaned up all the test code and any lingering comments that could
be removed. Included more comments for documentation purposes.