Changes to support Titanium JS SDK

cc @weili-feedhenry - appreciate your thoughts on what I've done here!