Improve code with Array.fill