Source code refactoring. Identified mergeable code using research tool a...

...nd merged them. Looking forward to feedbacks and continued contributions to code cleanup.