Updated the service script logic