feature: define an offset end for key scanning functions
improvement: using dict internally (again); about 2-3 x faster