Revert "Import original code from trunk."

This reverts commit e22c071a881968805ca0f2caa10d010df3764316.