Moved variable 'el' declaration into inner scope

Moving the `var el` declaration into the function scope where it is used makes for more readable code. And, as such, might avoid the introduction of bugs if the code is refactored in the future.