Added code to check table exists and create them if they don't