Added auto-freeze. Mostly untested