Add preliminary implementation of deinitialization