optimize kernel