Changed shifting code