Use is_null instead of == null. Fix up comments. Various other improvements