Optimized mog and mog2, which have much better performance.