added callbacks to Document model and added head title to index page