Add db.sql and updated some code