separation of DOM logic into direectives...untested