added thin and experimental thread support