Revisions to how charm works.

Optional SQL for charm rules
These changes are based on extensive live parsing. Logs available on request.