moved is_type from helpers to tools. cleaned up functions. more debug statements