almost done fixing dom bug