Moved some visualiser set up code into the markup file

...to reduce some duplication