properly handles resize events now