Acm looping and optimizations

Closes #161