Clean up sms script
Minor clean up
Minor fix to db script