Versatile solution

Versatile solution