DB is finally working!!! Scripting the procedure