Modified code to bring it back to a state that is closer to the original (upstream) code.