sws function to resize