Parameterize things

Parameterized everything, that could be. Also some minor cleanup.