WIP: some optimization in criteria