Made sample shifting function