updated to make arrays mutable