Merge pull request #282 from shenrie/master

Refactored extended resource objects for better reuse
agent uses threadsafe fsm
Thread safe fsm in agent.
Added first round of utf-8 support