Made the script safer by protecting against injection attacks