Optimize function for instructions