Replacing Lua-functions with built-in ngx. functions