Fixed how polygon objects are created via the API.

The parser was still making calls to the API's helper functions instead
of using the API calls directly. This has been fixed, but there are
still some functions in the API which provide too low-level of access to
object and polygon creation.
Cleaned up indenting and wrapped long lines.