Assigning a default value if available, an AttributeValue case is null. Rebase with previous versions is also included

This method needs some refactorings.