This also appears to be setting event handlers rather than creating elements, and could probably be reduced to some `on` calls.