Refactoring for frame resize