Bug fixes related to multi threading and Refactoring of code
Version 1