Moved code that updates debug polygons into its own method