In these schools children could be selected on the basis of curriculum aptitude related to the school's specialism even though the schools do take quotas from each quartile of the attainment range to ensure they were not selective by attainment. A problem with this is whether the quotas should be taken from a normal distribution or from the specific distribution of attainment in the immediate catchment area. In the selective school system, which survives in several parts of the United Kingdom, admission is dependent on selection criteria, most commonly a cognitive test or tests. Although comprehensive schools were introduced to England and Wales in 1965, there are 164 selective grammar schools that are still in operation.[citation needed] (though this is a small number compared to approximately 3500 state secondary schools in England). Most comprehensives are secondary schools for children between the ages of 11 to 16, but in a few areas there are comprehensive middle schools, and in some places the secondary level is divided into two, for students aged 11 to 14 and those aged 14 to 18, roughly corresponding to the US middle school (or junior high school) and high school, respectively. With the advent of key stages in the National Curriculum some local authorities reverted from the Middle School system to 11–16 and 11–18 schools so that the transition between schools corresponds to the end of one key stage and the start of another.