Improve debug output. Add contains method. Fix bug in kind method.