Some of this code was sent by Howard Miller, but I rewrote most of it to make it shorter and to fit in better with current code.
This is the first step towards more pluggable course formats that can be just dropped in to the system.