added thread control and logging

added classes for thread controls and logging.