using stdClass refactored a whole bunch of code.