Fixed schema template file and added/fixed routines for getting db/table objects and their names.