Refactored classes related to database interactions and networking.