This change also factors a bunch of assert methods in a single place which should slightly decrease binary size.