Add common functions for array manipulation