Refactored addArrayObserver and removeArrayObserver

Since they are more similar than dissimilar.