Adding unit testing and modify the script