LPS-44719 Bug fix

Re-coded based on your observations