clean rewrite of the mozilla format