Fixed several issues with the database functions and display issues.