added some helpful functions for working with arrays