Made functions to write scripts for queries 1,4, and 5