lots of misc changes to catch-up with API changes and to reflect refactoring in PHP SDK