What is the reason behind function inside function?