Huge performance fix on DOM manipulation