Use anon function to not polute global scope with function definition

Change-Id: I9fd07173ab18b78a8e1b91b138401acfee0e80d2
Merge "Use anon function to not polute global scope with function definition"