Add database and tables
Add main functions, need to fix)