Change of database.pl to make category self contain