Refactored/clarified query builders and sql expressions.