prevent freezes and make smooth