replaced resize with reserve