query and system helper functions reduced