Window resize function implemented