final working modified version with DomJudge @ 3.1.4