Improve elementwise script