function scope explanation added