Changing initialization to empty array instead of malloc