Fixes for Issue Id TOOLS-2526

This fix includes Java code level changes and refactoring