Edited the script for better results