broke code out into smaller modules.
more modularization, some cleanup