Flowcharted the type guessing process and implemented the logic. It's messy...need a tree of types (breaking out booleans-as-text from booleans-as-1-or-0).