Refactoring, some new functions for array computation/copying