major rewrite, adds detect support while maintaining old assert interface.
version bump to 0.2.0.a because some internal APIs were broken.