Major rewrite and lots of new is_* methods.