AhoC optimization