Further sanity checks and code clearing.