Initial merge of current updated version of tgdb.