Simplification of codepage code, and changing private methods to protected