Start of visualization code. I have a headache due to this.