Start documenting the magic module.
Refactor the magic module.

Not only is this now documented, but it's vastly easier to use than before.