Added separated resize function