added visualization code