Massachusetts school systems ranked the best in the nation, according to a recent survey. The Bay State was first in America both quality and safety.

Personal finance site, WalletHub compared the 50 states and the District of Columbia across 32 key measures of quality and safety to find the best school system, using criteria ranging from pupil-teacher ratio and dropout rate to median standardized-test scores.

Public schools in Massachusetts ranked first in math test scores and reading test scores. Massachusetts educators can also pride themselves for being tied for the top spot in median ACT scores as well.

Massachusetts wasn’t the only New England state to rank high in the list, neighboring Connecticut came in at #2, and New Hampshire rounded out the Top 5 in the survey. Vermont was 10th, and Rhode Island & Maine ranked 11th and 13th respectively.

According to the survey, New Mexico ranked last, having reportedly the worst school system in the nation.