restructuring, converted to using mysqli to run queries, new command line format