Some extra functions to work with arrays.