moved visualization code into visualize.js