Maybe this should be moved to core array