Call init_trellis() from the constructor, not the destructor.

Also, use member variables rather than statics to store state.