Moved the toPNG to a separate file since it's a side thing