Fixed broken logic

Shift logic was incorrect, fixed it, and generalized fn to work on the
whole strip or a region