Improve generics with respect to builder pattern / fluent API

Achieved through applying generics recursively.

+review REVIEW-5254