If you think about this method, is called createPolygon but you're also adding a listener to it, also, this makes your method to be long enough to know something is wrong xD.

Split it