fixed queries to work
Still needs a lot of error handling and
makign sure the input is formatted correctly