Cleaned up the resize stuff, and prevented unwanted resize events