Better ZC algorithm