Handle resize better