elwise refactoring

Refactoring of elwise so it uses the functor_arrfunc machinery.