Working on making all queries functional