Smarter way to initialize an array