Reworked JavaScript logic for database creation. Still in progress.