log file handling now in main, added basic thread functionality