Ongoing changes (part 2)

Rewrite of Enrollment, and other functions.  Moving retired code to
rewrite.R