Refactor the fix

Refactoring using Immutablist and firstNonNull