code and api cleanup - tabledef source