Refactored to set self.capacity