Restructuring database library