move resize logic to model