updated visualization code