Fixed some bugs and fully documented the database