Addes logic for shifting