Enhancements to main and to query processing