Added functionality of creating a database and table if one does not exist and various checks.