Lightly modified and count code added.