Corrected bugs

Need to correct the shift because it is only shifting by -1 everytime