Only initialize/deinit when necessary