First draft. Actual output HTML not checked.