failed to implement multi threading -- working code at this commit