refactored initialziation of array