subroutines in Grapher.cs