Added a class to generate queries; now running queries accordingly to the different layouts the results can land in