Standardize naming, use spans and references for input parameters, and improve documentation. Now the functions expect the lookups to succeed as well, they will fail and assert otherwise. The functions are also simple enough that it likely makes sense to keep them all inlined