properly clear document