Added SQL file for tables and fixed bug