Small modifications and virtual destructor added.