Move DOM manipulation to the route handler, where it belongs.