Add a size sanity check.
Simplify the size checker function.