Added normal array & for loop in offsetValues

Replaced dense array in `offsetValues` function to use a normal array
and for loop to prevent the call stack from exceeding it’s limit.

See related issue #15