finalized the queries, added to python script