refactoring the visualization code...