Refactoring of classes and database (#5).