improved queries.py, renamed files and changed code structure