Update with ptab's code changes.