Minor code rewriting for clarity.