Simplify and speed up openresty

With these changes there is less code, and it performs a few % better.