Improved Cloud Foundry Compatibility

Previously, the project generated payloads that met the documented
requirements of Cloud Foundry.  It turns out that this documentation
wasn't strict enough to create payloads that actually worked with
Cloud Foundry.  This change uses the information learned during trial-
and-error to update the payloads such that they actually work with
Cloud Foundry.

In addition to these changes there are slight changes to polish up the
existing code.