Fix recursive loop, simple statistics added.