This stuff belongs in a separate PR.