Made nested template regex flexible; added support for deep objects, fixed bug