Some more infrastructure and small fixes.