Optimize modes 23 and 24 a bit