Is it necessary to use nested function? especially when it doesn't share variables with outer function.