Refactor DOM structures