creating thread and device classes