reworked a lot of the c++ code now accepts sqlite db instead of text file