modifications in waitToEmpty