Added new funtions to the DB and fixed minor bugs