moves processComplexType into its own function. Minor style updates.
updates code to use phantomjs. error in $.ajax call