Added fucntions to run Queries 1 and 4.
Added sorting options to queries