Source code automation

This could use a good review to make sure I didn't overlook anything obvious. Also taking suggestions on alternatives to any weirdness you may see.

All tests pass.