refactored for loops and took out some accelerate functions that couldn’t be found.