Fixed errors in the accelerated algo