added james's patches and html entities