WIP implemented David's changes to query structure, refactored parameter lists and methods for readability, still needs to be updated for latest CME feedback