reorganize table files and begin query functions