bring a small computation out of a loop