added terminal resize code