destroy document functionality implemented