code clean-up and missing virtual desctructor added