Window resize event && refactoring