first implement line buffering