CRM-12942#comment-51519 fix
CRM-12942 : added closure for function definition and its usage, as to remove its global definition as mentioned in comment for PR#1059
Merge pull request #1059 from pratik-joshi/CRM-12942

CRM-12942  fix