A bunch of stuff I should have committed separately but didn't.

Mostly converting magic numbers to parameterized values.