Finished coverting the script in to ruby