New classes and updated SQL code