refactored to specify sizes as an array