The script is working proproperly now