Fixed a few bugs including using the wrong size value to put into the algorithm and using the wrong method to circular shift.