Bug fixes
Refactored code and Corrected bugs
Updated logging