Added Document Table to Database and other minor fixes