Refactor resize()