Debugged multi-threaded solution
Bug fixes