Vtgate

Solidifying existing code with cleanups and tests. This set is mostly for schema & selects.