The Roles of Mass and Environment in the Quenching of Galaxies