Cleaned up resize logic