checking in partial code for package error checking so we have a copy of it.