Added and sorted all flat tables with INT index, simple logic to main.cpp