Calculate changes of arrays based on content