Refactoring functions about resize and assign.