Prefer for over forEach, call over apply

Some performance cleanup stuff.