Cleaned up database structure and removed unused code