Added version 1 of shifting function