DOM manipulation, and some cleanup/adjustments