Simplified extractNamedVariables function, renamed it to 'variables'