try to access the dom the least as possible