Refactored array resize to the compute() method