Fixed some issues concerning document deletion.
View could use some polishing though.