update array and add math