Refactor encode_polygon method