Speed-up write alignment and tail code