Modification on script to create database, dynamic category