Added ThreadScope for automatic thread detach and GetEnv() which can be used to get env without forced attach.