Stupid code for resizing
Better code for resizing