first commit of DTRW code, incomplete