Resizing and code refactoring