Cleaning up visualization code