Write doctypes and fix randomness