Parameterization and more cleanup

Parameterized what could be and did even more cleanup.