ported DLAA + some code clearing here and there