Optimize code for cell position.